#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
#include<string.h>
#include <sys/types.h>


int sdfmain()
{
  int i = 0;
  printf("sdbmsd\n");
  for(i = 0; i < 150; i++)
    printf("%d: %s\n", i, strerror(i));// 返回错误码所代表的错误信息
  printf("gsdfavdj\n");
  printf("gsdfavdj\n");
  exit(153);
  printf("gsdfavdj\n");
  printf("gsdfavdj\n");
  printf("gsdfavdj\n");
  return 0;
}


int main()
{
  pid_t id = fork();
  if(id < 0)
  {
    perror("id < 0:");
    exit(1);
  }
  else if(id == 0)
  {
    //子进程
    int c = 5;
    while(c)
    {
      printf("c: %d, 子进程，pid:%d,ppid:%d", c, getpid(), getppid());
      sleep(1);
      c--;
    }
  }
  else 
  {
    //父进程  
    while(1)
    {
      printf("父进程，pid:%d,ppid:%d", getpid(), getppid());
      sleep(1);
    }
  }
  return 0;
}
